package com.my.xadmin.security.repository;
import com.my.framework.base.repository.BaseJpaDao;
import com.my.xadmin.security.entity.Config;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ConfigDAO extends BaseJpaDao<Config, Long> {
	Page<Config> findByKeyContaining(String key, Pageable pageable);
	
	@Query(value="select * from tb_config a where a.config_status=?1",nativeQuery=true)
	public List<Config> findByStatus(String status);
	
	@Query(value="select * from tb_config a where a.config_key= ?1",nativeQuery=true)
	public List<Config> findByKey(String key);
	
	@Query(value="select * from tb_config a where a.config_key= ?1 and a.id!= ?2",nativeQuery=true)
	public List<Config> findByKeyAndId(String key, Long id);
	
	@Query(value="select a.value from tb_config a where a.config_key=?1",nativeQuery=true)
	public String findValueBykey(String key);

	@Query(value="SELECT DMXZ,DMXMC from dic_gb3304_1991 ",nativeQuery=true)
	List<Object[]> findNationCode();
}
